<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>json</title>
    <script>

        var jsonObj = '{"name":"老李","age":59,"like":["旅游","运动"]}'; //json对象
        var jsonArr = '[11,"hello",true]';     //json数组
        var obj = JSON.parse(jsonObj);
        var arr = JSON.parse(jsonArr);
        console.log(obj.like[0]);     //结果：旅游   
        console.log(arr[2]);         //结果：true

        var person = { name: "老李", age: 59, like: ["旅游", "运动"] };  //js对象
        var jsonPerson = JSON.stringify(person);
        console.log(jsonPerson);  //结果：{"name":"老李","age":59,"like":["旅游","运动"]}
        console.log(typeof jsonPerson);    //类型为：string

    </script>
</head>

<body>

</body>

</html>